package com.sysu.dinner.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sysu.dinner.dao.RestaurantDAO;
import com.sysu.dinner.model.Manager;
import com.sysu.dinner.model.Restaurant;

@Component("restaurantService")
public class RestaurantService {
	private RestaurantDAO restaurantDao;
	
	public int addRestaurant(Restaurant restaurant) {
		if(restaurant != null)
			return restaurantDao.addRestaurant(restaurant);
		return -1;
	}
	
	public void updateRestaurant(Restaurant restaurant)
	{
		restaurantDao.updateRestaurant(restaurant);
	}
	
	public List<Restaurant> getAllRestaurants() {
		return restaurantDao.getAllRestaurants();
	}
	
	public Restaurant getRestaurantByManager(int mgrId)
	{
		return restaurantDao.getRestaurantByManager(mgrId);
	}

	@Resource
	public void setRestaurantDao(RestaurantDAO restaurantDao) {
		this.restaurantDao = restaurantDao;
	}

	public RestaurantDAO getRestaurantDao() {
		return restaurantDao;
	}
	
	
}
